Hi, First thanks for all the training videos you have posted, they are really very good I am going through your training of Programming for Fundamental Investing and right now on the code of Python Stock Screener for Price to Book. As yahoo as changed this website and also their content, completely different and complicated, would you mind also give a hint how to parse this new website? It would be very helpful Thanks for your help Jordi
You must be logged in to post. Please login or register an account.
I haven't looked, so my only hint would be to look at how we did it with Yahoo, and use similar tactics. You can also look into something like Beautiful Soup, which is meant for parsing.
The things that are hard to parse are dynamically generated contents via jquery. An easy way to check is to just open the page in a browser, and then view the source. Look for the stuff you're trying to parse, and see if it's there. If so, it's usually between SOME sort of a tag. In the case of Yahoo, it was all in a table, do it was between table data <td> tags.
-Harrison 8 years ago
You must be logged in to post. Please login or register an account.
Hi, Thanks for the advice. I found an example to use with Beautiful Soup: https://codedump.io/share/R8iCPEh6W3tM/1/using-beautifulsoup-to-search-through-yahoo-finance
Hereby the updated version:
#additionals imports from bs4 import BeautifulSoup import requests
#to replace in def yahooKeyStats(stock): r = requests.get('https://query1.finance.yahoo.com/v10/finance/quoteSummary/' + stock + '?formatted=true&crumb=zBOBWyyg2Zd&lang=en-US®ion=US&modules=defaultKeyStatistics%2CfinancialData%2CcalendarEvents&corsDomain=finance.yahoo.com')